﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TimberSmart.Model.Common  
{
    [Table("Person")]
    public class Person
    {
        public int Id { get; set; }

        [MaxLength(20)]
        public string Title { get; set; }

        [MaxLength(64)]
        public string Description { get; set; }

        [Required, MaxLength(32)]
        public string FirstName { get; set; }

        [Required, MaxLength(32)]
        public string LastName { get; set; }

        [Phone, MaxLength(32)]
        public string Phone { get; set; }

        [Phone, MaxLength(32)] // Need maxlength on these, otherwise they MAX :/
        public string Fax { get; set; }

        [EmailAddress, MaxLength(64)] // Need maxlength on these, otherwise they MAX :/
        public string Email { get; set; }

        [Url, MaxLength(64)] // Need maxlength on these, otherwise they MAX :/
        public string Web { get; set; }

        public DateTime? CreatedOn { get; set; } // Have to make them nullable. DateTime2 <-> DateTime issues when not initialised.

        public DateTime? LastUpdatedOn { get; set; }

        public bool Active { get; set; } // Do we need this? Person wont exist without context, maybe on subtypes.

        [Timestamp]
        public byte[] RowVersion { get; set; }

        //FK's
        public int? PostCodeID { get; set; }
        public virtual PostCode PostCode { get; set; }

        public virtual IEnumerable<Address> Addresses { get; set; }
    }
}
